package com.seguriapp.dao;

import static org.hibernate.criterion.Restrictions.eq;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.seguriapp.base.GenericDaoImpl;
import com.seguriapp.entities.District;

/**
 * Data access object for {@link District} entities using Hibernate.
 * 
 * @author Tania Gonzales (taniadgv@gmail.com)
 */
@Repository
public class DistrictDaoImpl extends GenericDaoImpl<District> implements DistrictDao {

  public DistrictDaoImpl() {
    super(District.class);
  }

  @SuppressWarnings("unchecked")
  public List<District> getDistrictsList(final Long provinceId) {
    return getSession().createCriteria(District.class).add(eq("province.id", provinceId)).list();
  }

}
